<template>
  <div>
    <elBread></elBread>
    <el-button class="xb" type="primary" size="small" plain @click="add">添加</el-button>
    <list @edit="edit"></list>
    <Dialog ref='diaInfo' @cancel="cancel" :isShow="isShow" :isAdd="isAdd"></Dialog>
  </div>
</template>
<script>
import list from './list.vue'
import Dialog from './dialog.vue'
export default {
  data() {
    return {
      isShow: false,
      isAdd: true,
    }
  },
  methods: {
    add() {
      //打开弹框
      this.isShow = true;
      //告诉弹框你是一个添加
      this.isAdd = true;
    },
    //关闭弹框
    cancel(e) {
      this.isShow = e;
    },
    //编辑
    edit(e) {
      //打开弹框
      this.isShow = true;
      //告诉弹框你是个编辑
      this.isAdd = false;
      this.$refs.diaInfo.lookup(e)
    },
  },
  components: {
    list,
    Dialog,
  },
}
</script>
<style lang="less">
.xb {
  margin: 10px 5px;
}
</style>